#include<stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include<unistd.h>
#include<string.h>
int main()
{
  /*FILE* pf = fopen("log.txt","w");
  const char* str = "hello word";
  int index = 0;
  fprintf(pf,"%s %d\n",str,index);*/ 
 // int fd = open("log.txt",O_WRONLY | O_CREAT | O_TRUNC,0666);
  int fd = open("log.txt",O_WRONLY | O_CREAT | O_APPEND,0666);
  if(fd < 0)
  {
    perror("fopen error!");
    return 1;
  }


  const char* message = "hello linux file\n";
  write(fd,message,strlen(message));
  return 0;
}
